//
//  TitleCell.m
//  ucas_on_hand
//
//  Created by DaveLam on 15/1/31.
//  Copyright (c) 2015年 ucas. All rights reserved.
//

#import "TitleCell.h"

@implementation TitleCell
@synthesize titleLabel=_titleLabel;
@synthesize separateBar=_separateBar;
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

-(id) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self){
        [self setBackgroundColor:[UIColor colorWithRed:68/255.0 green:71/255.0 blue:86/255.0 alpha:0.95]];
        
        _titleLabel=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 40)];
        _titleLabel.font = [UIFont fontWithName:@"Helvetica" size:20];
//        UIFont* infoFont=[UIFont systemFontOfSize:35.0];
//        [_titleLabel setAttributedText:[[NSMutableAttributedString alloc] initWithString:@"" attributes:@{NSFontAttributeName:infoFont}]];
        _titleLabel.textColor=[UIColor whiteColor];
        [self.contentView addSubview:_titleLabel];
        
        _separateBar=[[UIButton alloc] initWithFrame:CGRectMake(0, 0, 0, 5)];
        [_separateBar setBackgroundImage:[UIImage imageNamed:@"home_split_0"] forState:UIControlStateNormal];
        [self.contentView addSubview:_separateBar];
    }
    return self;
}

-(void) layoutSubviews{
    [super layoutSubviews];
    CGRect newFrame=_titleLabel.frame;
    newFrame.origin.x=self.revealSideInset.left+20;
    newFrame.origin.y=(self.frame.size.height-newFrame.size.height)/2.0;
    newFrame.size.width=self.frame.size.width-self.revealSideInset.left;
    _titleLabel.frame=newFrame;
    
    newFrame=_separateBar.frame;
    newFrame.origin.x=self.revealSideInset.left;
    newFrame.origin.y=self.frame.size.height-newFrame.size.height;
    newFrame.size.width=self.frame.size.width-self.revealSideInset.left;
    _separateBar.frame=newFrame;
}

@end
